export default (col, readonly, store) => {
    const { title: text, orderkey } = col;
    class Type extends GC.Spread.Sheets.CellTypes.Base {
        time = 0;
        getAutoFitWidth(value, a, cellStyle, zoomFactor, context) {
            //return Math.max(super.getAutoFitWidth(a, a, cellStyle, zoomFactor, context) + 30,super.getAutoFitWidth(text, text, cellStyle, zoomFactor, context) + 66);
            return super.getAutoFitWidth(text, text, cellStyle, zoomFactor, context) + 66;
        }

        processMouseUp(hitInfo) {
            // const newtime = new Date().getTime();
            // if(newtime - this.time < 200) {
            store.filterVisible = false;
            store.showData();
            // }
            // this.time = newtime;
            // this.time++;
            // clearTimeout(this.timer);
            // this.timer = setTimeout(() => {
            //     if(this.time > 1) {
            //         console.log('dbclick');
            //         store.showData();
            //         this.time = 0;
            //         return;
            //     } 
            //     console.log('in', this.time)
            //     this.time = 0;

            // }, 300);

        }
        processMouseMove(hitInfo) {

        }
        processMouseLeave(hitInfo) {

            return true;
        }
        getHitInfo(x, y, cellStyle, cellRect, context) {
            const info = {
                x,
                y,
                cellStyle,
                cellRect,
                ...context,
                filterButton: x > cellRect.x + cellRect.width - 18
            }
            return info;
        }
    }
    return new Type();
}